//
//  SellCoinVC.m
//  DirectMember
//
//  Created by jzd on 2018/6/26.
//  Copyright © 2018年 宋佳. All rights reserved.
//

#import "SellCoinVC.h"
#import "SellCoinCell.h"
#import "SellVC.h"

@interface SellCoinVC ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableV;

@end

@implementation SellCoinVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"卖出货币";
    
    [self.tableV registerNib:[UINib nibWithNibName:NSStringFromClass([SellCoinCell class]) bundle:nil] forCellReuseIdentifier:SellCoinCellIdentifier];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"turnOut"] style:UIBarButtonItemStylePlain target:self action:@selector(buyOnClick)];
}
-(void)buyOnClick{
    SellVC *vc = [[SellVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *backV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SJScreenW, 44)];
    backV.backgroundColor = RGBCOLOR(238, 238, 238);
    NSArray *titleArray = @[@"币种",@"数量",@"状态"];
    for (int i = 0; i<titleArray.count; i++) {
        UILabel *titLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 65, 44)];
        titLab.text = [titleArray objectAtIndex:i];
        titLab.textColor = [UIColor darkGrayColor];
        titLab.font = [UIFont systemFontOfSize:14.0];
        [backV addSubview:titLab];
        if (i == 0) {
            titLab.x = 15;
        }else if (i == 1){
            titLab.center = CGPointMake(SJScreenW*0.5, backV.height *0.5);
            titLab.textAlignment = NSTextAlignmentCenter;
        }else{
            titLab.x = SJScreenW-80;
            titLab.textAlignment = NSTextAlignmentRight;
        }
    }
    
    return backV;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 44;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 8;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SellCoinCell *cell = [tableView dequeueReusableCellWithIdentifier:SellCoinCellIdentifier];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

@end
